import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { HttpClientModule } from '@angular/common/http';
import { AppComponent } from './app.component';
import { LoginModule } from './framework/login/login.module';
import { FrameworkModule } from './framework/framework.module';
import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { RefreshTokenService } from './shared/services/refreshToken.service';
import { AuthGuard } from './guards/auth.guard';
import { RouteGuard } from './guards/route.guard';
import { RefreshTokenInterceptor } from './shared/interceptor/refresh.interceptor';
import { AuthInterceptor } from './shared/interceptor/auth.interceptor';
import { AppRoutesModule } from './app.routes';
import { LoaderModule } from './shared/components/loader/loader.module';
import { SpinnerModule } from './shared/components/spinner/spinner.module';
import { AuthenticationService } from './framework/login/login.service';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ToastModule } from 'ng6-toastr';
import { SignalRService } from './shared/services/signalR.service';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    LoginModule,
    FrameworkModule,
    AppRoutesModule,
    LoaderModule,
    SpinnerModule,
    BrowserAnimationsModule,
    ToastModule.forRoot()
  ],
  providers: [
    AuthenticationService,
    RefreshTokenService,
    SignalRService,
    AuthGuard,
    RouteGuard,
    {
      provide: HTTP_INTERCEPTORS,
      useClass: RefreshTokenInterceptor,
      multi: true
    },
    {
      provide: HTTP_INTERCEPTORS,
      useClass: AuthInterceptor,
      multi: true
    }
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
